package com.top145;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;

public class Solution38 {
    public static void main(String[] args) {
        TreeMap<Object, Object> objectObjectTreeMap = new TreeMap<>();
        HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
        Hashtable<Object, Object> objectObjectHashtable = new Hashtable<>();
        ConcurrentHashMap<Object, Object> objectObjectConcurrentHashMap = new ConcurrentHashMap<>();
        Scanner scanner = new Scanner(System.in);
        System.out.println(countAndSay(scanner.nextInt()));
    }
    public static String countAndSay(int n) {
        StringBuffer res = new StringBuffer(String.valueOf(1));
        if (n == 1) return res.toString();
        int index = 1;
        int count = 1;
        while (--n > 0) {
            String str = res.toString();
            res.delete(0, res.length());
            while (index < str.length()) {
                if (str.charAt(index) == str.charAt(index - 1)) {
                    count++;
                    index++;
                } else {
                    res.append(count);
                    count = 1;
                    res.append(str.charAt(index - 1));
                    index++;
                }
            }
            res.append(count);
            count = 1;
            res.append(str.charAt(index - 1));
            index = 1;
        }
        return res.toString();
    }
}
